--众心不聚
local zhongxinbuju = fk.CreateSkill {
    name = "mcdh_zhongxinbuju",
    tags={Skill.Lord}
}

zhongxinbuju:addEffect(fk.EventPhaseEnd,{
    can_trigger=function (self, event, target, player, data)
        return player:hasSkill(zhongxinbuju.name)  and data.phase == Player.Finish
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local use =room:askToUseVirtualCard(target,{prompt="#mcdh_zhongxinbuju-use:"..player.id,skill_name=zhongxinbuju.name,name="snatch",skip = true,extra_data={exclusive_targets={room:getOtherPlayers(player)}}})
        if use  then
            event:setCostData(self,use)
            return true
        end
    end,
    on_use=function (self, event, target, player, data)
        local room = player.room
        local use = event:getCostData(self)
        room:useCard(use)
        
        if not table.every(player.room.alive_players, function (p)
            return p.hp >= player.hp
        end) then
            if not player.dead then
                player:drawCards(2,zhongxinbuju.name)
            end
            if not player.dead then
                room:damage({
                    to = player,
                    from = target,
                    damage = 1,
                    skillName = zhongxinbuju.name
                })
            end
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_zhongxinbuju"] = "众心不聚",
    [":mcdh_zhongxinbuju"] = "主公技，每名角色的结束阶段，其可以视为使用一张目标不为你的【顺手牵羊】，然后若你体力值不为全场最小，你摸两张牌，其对你造成1点伤害。",
    ["#mcdh_zhongxinbuju-use"] = "众心不聚:视为使用一张目标不为 %src 的【顺手牵羊】",
}

return zhongxinbuju